package com.xqboss.apps.service.nft;

import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xqboss.apps.domain.nft.NftPublishLog;
import com.xqboss.apps.dto.nft.bo.NftNumberBO;
import com.xqboss.apps.mapper.nft.NftPublishLogMapper;
import com.xqboss.apps.enums.nft.EnumNftPublishLog;
import org.springframework.stereotype.Service;

/**
 * <p>
 * nft发行记录 服务实现类
 * </p>
 *
 * @author hqw11
 * @since 2022-12-08
 */
@Service
public class NftPublishLogService extends ServiceImpl<NftPublishLogMapper, NftPublishLog> implements IService<NftPublishLog> {

    /**
     * 添加
     *
     * @param nftId
     */
    public NftPublishLog init(Long nftId, String nftNumber, NftNumberBO nftNumberBO) {
        NftPublishLog nftPublishLog = new NftPublishLog();
        nftPublishLog.setNftId(nftId);
        nftPublishLog.setNftNumber(nftNumber);
        nftPublishLog.setNftStat(EnumNftPublishLog.NftStat.wck.getKey());
        nftPublishLog.setUnitIds(nftNumberBO.getUnitIds());
        nftPublishLog.setUnitImgList(nftNumberBO.getUnitImgListStr());
        if (nftNumberBO.getUid() != null) {
            nftPublishLog.setAdminId(nftNumberBO.getUid().longValue());
            nftPublishLog.setAdminName(nftNumberBO.getUserName());
        }
        return nftPublishLog;
    }

}
